package com.aiyige.base.db.table;

import android.os.Parcel;
import android.os.Parcelable;

import com.aiyige.city.model.City;
import com.aiyige.model.moment.backup.CardBackup;
import com.aiyige.model.moment.backup.TagBackup;
import com.aiyige.model.moment.entity.Moment;
import com.aiyige.model.moment.entity.TrainingCourse;
import com.aiyige.page.publish.selectinterest.model.PublishIndustryItem;
import com.aiyige.page.publish.selectinterest.model.PublishInterestItem;
import com.aiyige.page.publish.selecttraingcard.model.TraingCard;
import com.aiyige.page.publish.traingclass.model.ClassLocation;
import com.aiyige.page.publish.traingclass.model.TraingClassFormModel;
import com.aiyige.page.publish.util.PublishUtil;
import com.aiyige.utils.AccountUtil;
import com.aiyige.utils.DummyDataUtil;
import com.aiyige.utils.ListUtil;
import com.aiyige.utils.StringUtils;
import com.alibaba.fastjson.JSON;
import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import java.util.LinkedList;
import java.util.List;

/**
 * Created by zhuyakun on 2017/12/14.
 */
@DatabaseTable(tableName = "TraingClassDBModel")
public class TraingClassDBModel implements Parcelable {
    public static final String ID_FIELD = "id";
    public static final String CONTROL_OPTION_FIELD = "controlOption";
    public static final String PROGRESS_STATUS_FIELD = "progressStatus";
    public static final String USER_ID_FIELD = "userId";
    public static final String GOODS_ID_FIELD = "goodsId";
    public static final String ROUTER_FIELD = "router";
    public static final String RETRY_COUNT_FIELD = "retryCount";
    public static final String TRAING_CARD_FIELD = "traingCard";
    @DatabaseField(id = true, columnName = ID_FIELD)
    String id;

    @DatabaseField(columnName = USER_ID_FIELD)
    String userId;

    @DatabaseField
    String title;

    @DatabaseField
    String interest;

    @DatabaseField
    boolean openBuy;

    @DatabaseField
    String classSize;

    @DatabaseField
    int openClassCondition;

    @DatabaseField
    String minClassSize;

    @DatabaseField
    Long confirmDate;

    @DatabaseField
    Long startClassDate;

    @DatabaseField
    Long endClassDate;

    @DatabaseField(dataType = DataType.LONG_STRING)
    String classLocation;

    @DatabaseField(dataType = DataType.LONG_STRING)
    String suitableLearnAge;

    @DatabaseField(dataType = DataType.LONG_STRING)
    String learnTarget;

    @DatabaseField(dataType = DataType.LONG_STRING)
    String suitablePeople;

    @DatabaseField(dataType = DataType.LONG_STRING)
    String tagJson;

    @DatabaseField
    String price;

    @DatabaseField
    String platformDividend;

    @DatabaseField
    String courseNumber;

    @DatabaseField(columnName = TRAING_CARD_FIELD, dataType = DataType.LONG_STRING)
    String traingCard;

    @DatabaseField
    String singlePrice;

    @DatabaseField(dataType = DataType.LONG_STRING)
    String courseDesc;

    @DatabaseField
    String coverUrl;

    @DatabaseField
    String coverStoreKey;

    @DatabaseField
    boolean coverNeedUpload;

    @DatabaseField(dataType = DataType.LONG_STRING)
    String courseSchedule;

    @DatabaseField
    int publishOperationType;

    @DatabaseField
    String singleClassDuration;

    @DatabaseField(columnName = PROGRESS_STATUS_FIELD)
    int progressStatus;

    @DatabaseField(columnName = CONTROL_OPTION_FIELD)
    int controlOption;

    @DatabaseField(columnName = GOODS_ID_FIELD)
    String goodsId;

    @DatabaseField
    long releaseDate;

    @DatabaseField(dataType = DataType.LONG_STRING)
    String guarantee;

    @DatabaseField(columnName = ROUTER_FIELD)
    String router;

    @DatabaseField(columnName = RETRY_COUNT_FIELD)
    int retryCount;

    float uploadedPercent = 0f;

    String rejectReason;

    public TraingClassDBModel() {
    }

    private TraingClassDBModel(Builder builder) {
        setId(builder.id);
        setUserId(builder.userId);
        setTitle(builder.title);
        setInterest(builder.interest);
        setOpenBuy(builder.openBuy);
        setClassSize(builder.classSize);
        setOpenClassCondition(builder.openClassCondition);
        setMinClassSize(builder.minClassSize);
        setConfirmDate(builder.confirmDate);
        setStartClassDate(builder.startClassDate);
        setEndClassDate(builder.endClassDate);
        setClassLocation(builder.classLocation);
        setSuitableLearnAge(builder.suitableLearnAge);
        setLearnTarget(builder.learnTarget);
        setSuitablePeople(builder.suitablePeople);
        setTagJson(builder.tagJson);
        setPrice(builder.price);
        setPlatformDividend(builder.platformDividend);
        setCourseNumber(builder.courseNumber);
        setTraingCard(builder.traingCard);
        setSinglePrice(builder.singlePrice);
        setCourseDesc(builder.courseDesc);
        setCoverUrl(builder.coverUrl);
        setCoverStoreKey(builder.coverStoreKey);
        setCoverNeedUpload(builder.coverNeedUpload);
        setCourseSchedule(builder.courseSchedule);
        setPublishOperationType(builder.publishOperationType);
        setSingleClassDuration(builder.singleClassDuration);
        setProgressStatus(builder.progressStatus);
        setControlOption(builder.controlOption);
        setGoodsId(builder.goodsId);
        setReleaseDate(builder.releaseDate);
        setGuarantee(builder.guarantee);
        setRouter(builder.router);
        setRetryCount(builder.retryCount);
        setUploadedPercent(builder.uploadedPercent);
        setRejectReason(builder.rejectReason);
    }

    public static Builder newBuilder() {
        return new Builder();
    }


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getInterest() {
        return interest;
    }

    public void setInterest(String interest) {
        this.interest = interest;
    }

    public boolean isOpenBuy() {
        return openBuy;
    }

    public void setOpenBuy(boolean openBuy) {
        this.openBuy = openBuy;
    }

    public String getClassSize() {
        return classSize;
    }

    public void setClassSize(String classSize) {
        this.classSize = classSize;
    }

    public int getOpenClassCondition() {
        return openClassCondition;
    }

    public void setOpenClassCondition(int openClassCondition) {
        this.openClassCondition = openClassCondition;
    }

    public String getMinClassSize() {
        return minClassSize;
    }

    public void setMinClassSize(String minClassSize) {
        this.minClassSize = minClassSize;
    }

    public Long getConfirmDate() {
        return confirmDate;
    }

    public void setConfirmDate(Long confirmDate) {
        this.confirmDate = confirmDate;
    }

    public Long getStartClassDate() {
        return startClassDate;
    }

    public void setStartClassDate(Long startClassDate) {
        this.startClassDate = startClassDate;
    }

    public Long getEndClassDate() {
        return endClassDate;
    }

    public void setEndClassDate(Long endClassDate) {
        this.endClassDate = endClassDate;
    }

    public String getClassLocation() {
        return classLocation;
    }

    public void setClassLocation(String classLocation) {
        this.classLocation = classLocation;
    }

    public String getSuitableLearnAge() {
        return suitableLearnAge;
    }

    public void setSuitableLearnAge(String suitableLearnAge) {
        this.suitableLearnAge = suitableLearnAge;
    }

    public String getLearnTarget() {
        return learnTarget;
    }

    public void setLearnTarget(String learnTarget) {
        this.learnTarget = learnTarget;
    }

    public String getSuitablePeople() {
        return suitablePeople;
    }

    public void setSuitablePeople(String suitablePeople) {
        this.suitablePeople = suitablePeople;
    }

    public String getTagJson() {
        return tagJson;
    }

    public void setTagJson(String tagJson) {
        this.tagJson = tagJson;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getPlatformDividend() {
        return platformDividend;
    }

    public void setPlatformDividend(String platformDividend) {
        this.platformDividend = platformDividend;
    }

    public String getCourseNumber() {
        return courseNumber;
    }

    public void setCourseNumber(String courseNumber) {
        this.courseNumber = courseNumber;
    }

    public String getTraingCard() {
        return traingCard;
    }

    public void setTraingCard(String traingCard) {
        this.traingCard = traingCard;
    }

    public String getSinglePrice() {
        return singlePrice;
    }

    public void setSinglePrice(String singlePrice) {
        this.singlePrice = singlePrice;
    }

    public String getCourseDesc() {
        return courseDesc;
    }

    public void setCourseDesc(String courseDesc) {
        this.courseDesc = courseDesc;
    }

    public String getCoverUrl() {
        return coverUrl;
    }

    public void setCoverUrl(String coverUrl) {
        this.coverUrl = coverUrl;
    }

    public String getCoverStoreKey() {
        return coverStoreKey;
    }

    public void setCoverStoreKey(String coverStoreKey) {
        this.coverStoreKey = coverStoreKey;
    }

    public boolean isCoverNeedUpload() {
        return coverNeedUpload;
    }

    public void setCoverNeedUpload(boolean coverNeedUpload) {
        this.coverNeedUpload = coverNeedUpload;
    }

    public String getCourseSchedule() {
        return courseSchedule;
    }

    public void setCourseSchedule(String courseSchedule) {
        this.courseSchedule = courseSchedule;
    }

    public int getPublishOperationType() {
        return publishOperationType;
    }

    public void setPublishOperationType(int publishOperationType) {
        this.publishOperationType = publishOperationType;
    }

    public String getSingleClassDuration() {
        return singleClassDuration;
    }

    public void setSingleClassDuration(String singleClassDuration) {
        this.singleClassDuration = singleClassDuration;
    }

    public int getProgressStatus() {
        return progressStatus;
    }

    public void setProgressStatus(int progressStatus) {
        this.progressStatus = progressStatus;
    }

    public int getControlOption() {
        return controlOption;
    }

    public void setControlOption(int controlOption) {
        this.controlOption = controlOption;
    }

    public String getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(String goodsId) {
        this.goodsId = goodsId;
    }

    public long getReleaseDate() {
        return releaseDate;
    }

    public void setReleaseDate(long releaseDate) {
        this.releaseDate = releaseDate;
    }

    public String getGuarantee() {
        return guarantee;
    }

    public void setGuarantee(String guarantee) {
        this.guarantee = guarantee;
    }

    public String getRouter() {
        return router;
    }

    public void setRouter(String router) {
        this.router = router;
    }

    public int getRetryCount() {
        return retryCount;
    }

    public void setRetryCount(int retryCount) {
        this.retryCount = retryCount;
    }

    public float getUploadedPercent() {
        return uploadedPercent;
    }

    public void setUploadedPercent(float uploadedPercent) {
        this.uploadedPercent = uploadedPercent;
    }

    public String getRejectReason() {
        return rejectReason;
    }

    public void setRejectReason(String rejectReason) {
        this.rejectReason = rejectReason;
    }

    public static Creator<TraingClassDBModel> getCREATOR() {
        return CREATOR;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.userId);
        dest.writeString(this.title);
        dest.writeString(this.interest);
        dest.writeByte(this.openBuy ? (byte) 1 : (byte) 0);
        dest.writeString(this.classSize);
        dest.writeInt(this.openClassCondition);
        dest.writeString(this.minClassSize);
        dest.writeLong(this.confirmDate);
        dest.writeLong(this.startClassDate);
        dest.writeLong(this.endClassDate);
        dest.writeString(this.classLocation);
        dest.writeString(this.suitableLearnAge);
        dest.writeString(this.learnTarget);
        dest.writeString(this.suitablePeople);
        dest.writeString(this.tagJson);
        dest.writeString(this.price);
        dest.writeString(this.platformDividend);
        dest.writeString(this.courseNumber);
        dest.writeString(this.traingCard);
        dest.writeString(this.singlePrice);
        dest.writeString(this.courseDesc);
        dest.writeString(this.coverUrl);
        dest.writeString(this.coverStoreKey);
        dest.writeByte(this.coverNeedUpload ? (byte) 1 : (byte) 0);
        dest.writeString(this.courseSchedule);
        dest.writeInt(this.publishOperationType);
        dest.writeString(this.singleClassDuration);
        dest.writeInt(this.progressStatus);
        dest.writeInt(this.controlOption);
        dest.writeString(this.goodsId);
        dest.writeLong(this.releaseDate);
        dest.writeString(this.guarantee);
        dest.writeString(this.router);
        dest.writeInt(this.retryCount);
        dest.writeFloat(this.uploadedPercent);
        dest.writeString(this.rejectReason);
    }

    protected TraingClassDBModel(Parcel in) {
        this.id = in.readString();
        this.userId = in.readString();
        this.title = in.readString();
        this.interest = in.readString();
        this.openBuy = in.readByte() != 0;
        this.classSize = in.readString();
        this.openClassCondition = in.readInt();
        this.minClassSize = in.readString();
        this.confirmDate = in.readLong();
        this.startClassDate = in.readLong();
        this.endClassDate = in.readLong();
        this.classLocation = in.readString();
        this.suitableLearnAge = in.readString();
        this.learnTarget = in.readString();
        this.suitablePeople = in.readString();
        this.tagJson = in.readString();
        this.price = in.readString();
        this.platformDividend = in.readString();
        this.courseNumber = in.readString();
        this.traingCard = in.readString();
        this.singlePrice = in.readString();
        this.courseDesc = in.readString();
        this.coverUrl = in.readString();
        this.coverStoreKey = in.readString();
        this.coverNeedUpload = in.readByte() != 0;
        this.courseSchedule = in.readString();
        this.publishOperationType = in.readInt();
        this.singleClassDuration = in.readString();
        this.progressStatus = in.readInt();
        this.controlOption = in.readInt();
        this.goodsId = in.readString();
        this.releaseDate = in.readLong();
        this.guarantee = in.readString();
        this.router = in.readString();
        this.retryCount = in.readInt();
        this.uploadedPercent = in.readFloat();
        this.rejectReason = in.readString();
    }

    public static final Creator<TraingClassDBModel> CREATOR = new Creator<TraingClassDBModel>() {
        @Override
        public TraingClassDBModel createFromParcel(Parcel source) {
            return new TraingClassDBModel(source);
        }

        @Override
        public TraingClassDBModel[] newArray(int size) {
            return new TraingClassDBModel[size];
        }
    };

    public static TraingClassDBModel parse(Moment moment) {
        TrainingCourse trainingCourse;
        try {
            trainingCourse = JSON.parseObject(moment.getMoreBackup(), TrainingCourse.class);
        } catch (Exception e) {
            trainingCourse = new TrainingCourse();
        }
        int progressStatus;
        switch (moment.getStatus()) {
            case Moment.STATUS_IN_REVIEW:
                progressStatus = PublishUtil.PROGRESS_STATUS_IN_REVIEW;
                break;
            case Moment.STATUS_REJECT:
                progressStatus = PublishUtil.PROGRESS_STATUS_REJECT;
                break;
            case Moment.STATUS_PUT_ON:
                progressStatus = PublishUtil.PROGRESS_STATUS_PUBLISHED;
                break;
            case Moment.STATUS_SAVE:
                progressStatus = PublishUtil.PROGRESS_STATUS_NOT_PUBLISHED;
                break;
            case Moment.STATUS_REVIEW_PASSED:
                progressStatus = PublishUtil.PROGRESS_STATUS_PUBLISHED;
                break;
            case Moment.STATUS_GET_OFF:
                progressStatus = PublishUtil.PROGRESS_STATUS_NOT_PUBLISHED;
                break;
            case Moment.STATUS_TRANSCODING:
                progressStatus=PublishUtil.PROGRESS_STATUS_SERVER_TRANSCODING;
                break;
            default:
                progressStatus = PublishUtil.PROGRESS_STATUS_NOT_PUBLISHED;
                break;
        }
        String categoryName = "";
        String subGroupType = "";
        String subGroupName = "";
        for (TagBackup tagBackup : moment.getTags()) {
            if (tagBackup == null) continue;
            if (tagBackup.getId().equals(moment.getCategoryId())) {
                categoryName = tagBackup.getName() == null ? "" : tagBackup.getName();
                subGroupType = tagBackup.getSubGroupType() == null ? "" : tagBackup.getSubGroupType();
                subGroupName = tagBackup.getSubGroupName() == null ? "" : tagBackup.getSubGroupName();
                break;
            }
        }
        int openClassCondition = TraingClassFormModel.OPEN_CLASS_CONDITION_DEPEND_ON_OPEN_DATE;
        try {
            switch (trainingCourse.getTakeEffectCondition()) {
                case Moment.COURSE_TAKE_EFFECT_CONDITION_OPEN_DATE:
                    openClassCondition = TraingClassFormModel.OPEN_CLASS_CONDITION_DEPEND_ON_OPEN_DATE;
                    break;
                case Moment.COURSE_TAKE_EFFECT_CONDITION_POPULATION:
                    openClassCondition = TraingClassFormModel.OPEN_CLASS_CONDITION_DEPEND_ON_POPULATION;
                    break;
            }
        } catch (Exception e) {

        }
        String classLocationJson;
        try {
            City city = DummyDataUtil.getCityById(moment.getCityId());
            classLocationJson = JSON.toJSONString(ClassLocation.newBuilder()
                    .id(city.getId())
                    .city(city.getCity())
                    .province(city.getProvince())
                    .build());
        } catch (Exception e) {
            classLocationJson = JSON.toJSONString(ClassLocation.newBuilder().build());
        }

        List<TraingCard> traingCardList = new LinkedList<>();
        try {
            for (CardBackup cardBackup : trainingCourse.getBindCardBackup()) {
                int traingCardType;
                switch (cardBackup.getCardType()) {
                    case Moment.TRAINING_CARD_TYPE_MEASURED_CARD:
                        traingCardType = TraingCard.TYPE_COUNT_CARD;
                        break;
                    case Moment.TRAINING_CARD_TYPE_RECHARGEABLE_CARD:
                        traingCardType = TraingCard.TYPE_PREPAID_CARD;
                        break;
                    case Moment.TRAINING_CARD_TYPE_TIME_CARD:
                        traingCardType = TraingCard.TYPE_TIME_CARD;
                        break;
                    default:
                        traingCardType = TraingCard.TYPE_TIME_CARD;
                        break;
                }
                traingCardList.add(TraingCard.newBuilder()
                        .id(cardBackup.getId())
                        .type(traingCardType)
                        .title(cardBackup.getTitle())
                        .build());
            }
        } catch (Exception e) {

        }


        return TraingClassDBModel.newBuilder()
                .userId(AccountUtil.getCurrentUser().getId())
                .title(moment.getTitle())
                .interest(JSON.toJSONString(PublishInterestItem.newBuilder()
                        .id(moment.getCategoryId())
                        .title(categoryName)
                        .parent(PublishIndustryItem.newBuilder()
                                .id(subGroupType)
                                .title(subGroupName)
                                .build())
                        .build()))
                .openBuy(moment.getLetBuy())
                .classSize(trainingCourse.getStudentMax() == null ? null : String.valueOf(trainingCourse.getStudentMax()))
                .openClassCondition(openClassCondition)
                .minClassSize(trainingCourse.getStudentMin() == null ? null : String.valueOf(trainingCourse.getStudentMin()))
                .confirmDate(trainingCourse.getConfirmStartClassDate())
                .startClassDate(trainingCourse.getStartDate())
                .endClassDate(trainingCourse.getEndDate())
                .classLocation(classLocationJson)
                .price(trainingCourse.getPrice() == null ? null : StringUtils.priceFormat(trainingCourse.getPrice()))
                .platformDividend(trainingCourse.getDivisionProportion() == null ? StringUtils.priceFormat(PublishUtil.MIN_PLATFORM_DIVIDEND * 100) : StringUtils.priceFormat(trainingCourse.getDivisionProportion() * 100))
                .courseNumber(trainingCourse.getClassCount() == null ? null : String.valueOf(trainingCourse.getClassCount()))
                .traingCard(JSON.toJSONString(traingCardList))
                .singlePrice(trainingCourse.getUnitPrice() == null ? null : StringUtils.priceFormat(trainingCourse.getUnitPrice()))
                .coverUrl(ListUtil.isEmpty(moment.getCover()) ? "" : moment.getCover().get(0))
                .coverNeedUpload(false)
                .singleClassDuration(trainingCourse.getDruationPerClass() == null ? null : String.valueOf(trainingCourse.getDruationPerClass()))
                .progressStatus(progressStatus)
                .goodsId(moment.getId())
                .releaseDate(moment.getOnsellTime())
                .router(moment.getRouter())
                .rejectReason(moment.getRemark())
                .build();
    }


    public static final class Builder {
        private String id;
        private String userId;
        private String title;
        private String interest;
        private boolean openBuy;
        private String classSize;
        private int openClassCondition;
        private String minClassSize;
        private Long confirmDate;
        private Long startClassDate;
        private Long endClassDate;
        private String classLocation;
        private String suitableLearnAge;
        private String learnTarget;
        private String suitablePeople;
        private String tagJson;
        private String price;
        private String platformDividend;
        private String courseNumber;
        private String traingCard;
        private String singlePrice;
        private String courseDesc;
        private String coverUrl;
        private String coverStoreKey;
        private boolean coverNeedUpload;
        private String courseSchedule;
        private int publishOperationType;
        private String singleClassDuration;
        private int progressStatus;
        private int controlOption;
        private String goodsId;
        private long releaseDate;
        private String guarantee;
        private String router;
        private int retryCount;
        private float uploadedPercent;
        private String rejectReason;

        private Builder() {
            id = "";
            goodsId = "";
        }

        public Builder id(String id) {
            this.id = id;
            return this;
        }

        public Builder userId(String userId) {
            this.userId = userId;
            return this;
        }

        public Builder title(String title) {
            this.title = title;
            return this;
        }

        public Builder interest(String interest) {
            this.interest = interest;
            return this;
        }

        public Builder openBuy(boolean openBuy) {
            this.openBuy = openBuy;
            return this;
        }

        public Builder classSize(String classSize) {
            this.classSize = classSize;
            return this;
        }

        public Builder openClassCondition(int openClassCondition) {
            this.openClassCondition = openClassCondition;
            return this;
        }

        public Builder minClassSize(String minClassSize) {
            this.minClassSize = minClassSize;
            return this;
        }

        public Builder confirmDate(Long confirmDate) {
            this.confirmDate = confirmDate;
            return this;
        }

        public Builder startClassDate(Long startClassDate) {
            this.startClassDate = startClassDate;
            return this;
        }

        public Builder endClassDate(Long endClassDate) {
            this.endClassDate = endClassDate;
            return this;
        }

        public Builder classLocation(String classLocation) {
            this.classLocation = classLocation;
            return this;
        }

        public Builder suitableLearnAge(String suitableLearnAge) {
            this.suitableLearnAge = suitableLearnAge;
            return this;
        }

        public Builder learnTarget(String learnTarget) {
            this.learnTarget = learnTarget;
            return this;
        }

        public Builder suitablePeople(String suitablePeople) {
            this.suitablePeople = suitablePeople;
            return this;
        }

        public Builder tagJson(String tagJson) {
            this.tagJson = tagJson;
            return this;
        }

        public Builder price(String price) {
            this.price = price;
            return this;
        }

        public Builder platformDividend(String platformDividend) {
            this.platformDividend = platformDividend;
            return this;
        }

        public Builder courseNumber(String courseNumber) {
            this.courseNumber = courseNumber;
            return this;
        }

        public Builder traingCard(String traingCard) {
            this.traingCard = traingCard;
            return this;
        }

        public Builder singlePrice(String singlePrice) {
            this.singlePrice = singlePrice;
            return this;
        }

        public Builder courseDescJson(String courseDescJson) {
            this.courseDesc = courseDescJson;
            return this;
        }

        public Builder coverUrl(String coverUrl) {
            this.coverUrl = coverUrl;
            return this;
        }

        public Builder coverStoreKey(String coverStoreKey) {
            this.coverStoreKey = coverStoreKey;
            return this;
        }

        public Builder coverNeedUpload(boolean coverNeedUpload) {
            this.coverNeedUpload = coverNeedUpload;
            return this;
        }

        public Builder courseScheduleJson(String courseScheduleJson) {
            this.courseSchedule = courseScheduleJson;
            return this;
        }

        public Builder publishOperationType(int publishOperationType) {
            this.publishOperationType = publishOperationType;
            return this;
        }

        public Builder singleClassDuration(String singleClassDuration) {
            this.singleClassDuration = singleClassDuration;
            return this;
        }

        public Builder progressStatus(int progressStatus) {
            this.progressStatus = progressStatus;
            return this;
        }

        public Builder controlOption(int controlOption) {
            this.controlOption = controlOption;
            return this;
        }

        public Builder goodsId(String goodsId) {
            this.goodsId = goodsId;
            return this;
        }

        public Builder releaseDate(long releaseDate) {
            this.releaseDate = releaseDate;
            return this;
        }

        public Builder guarantee(String guarantee) {
            this.guarantee = guarantee;
            return this;
        }

        public Builder router(String router) {
            this.router = router;
            return this;
        }

        public Builder retryCount(int retryCount) {
            this.retryCount = retryCount;
            return this;
        }

        public Builder uploadedPercent(float uploadedPercent) {
            this.uploadedPercent = uploadedPercent;
            return this;
        }

        public Builder rejectReason(String rejectReason) {
            this.rejectReason = rejectReason;
            return this;
        }

        public TraingClassDBModel build() {
            return new TraingClassDBModel(this);
        }
    }
}
